package com.education.basic.action;

import com.education.basic.service.impl.SystemDataCountService;
import com.yunshangwoniu.core.baseAction.BaseAction;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.Map;


@Controller
@Scope("prototype")
@Namespace("/sys-data")
@ParentPackage(value="struts-default")
public class SystemDataAction extends BaseAction
{
    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Resource
    private SystemDataCountService systemDataCountService;
    private Map<String,Long> count;

    @Action(value="list",results={@Result(name="success",location="list.jsp")})
    public String list()
    {
        count = systemDataCountService.count();
        return SUCCESS;
    }
    @Action(value="list-admin",results={@Result(name="success",location="list-admin.jsp")})
    public String listAdmin()
    {
        count = systemDataCountService.countAdmin();
        return SUCCESS;
    }

    public SystemDataCountService getSystemDataCountService() {
        return systemDataCountService;
    }

    public void setSystemDataCountService(SystemDataCountService systemDataCountService) {
        this.systemDataCountService = systemDataCountService;
    }

    public Map<String, Long> getCount() {
        return count;
    }

    public void setCount(Map<String, Long> count) {
        this.count = count;
    }
}
